﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<title>S_GetSelectxxxの使用例</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="../sakura.css">
<meta http-equiv="Content-type" content="text/html; charset=UTF-8">
</head>
<body>
<small>
Sakura-Editor Macro Reference
</small>
<h2>S_GetSelectxxxの使用例</h2>

<pre>
<span style="color:green;">//sample.js
//カーソル位置の単語のバイト数</span>
<span style="color:blue;">SelectWord</span>;
<span style="color:blue;">var</span> iLen = <span style="color:blue;">GetSelectColmTo</span> - <span style="color:blue;">GetSelectColmFrom</span>;

<span style="color:blue;">var</span> oWsh = <span style="color:blue;">new</span> ActiveXObject(<span style="color:#800000;">"WScript.Shell"</span>);
oWsh.Popup(iLen + "byte", <span style="color:red;">0</span>, <span style="color:#800000;">""</span>, <span style="color:red;">0</span>);
</pre>

<pre>
<span style="color:green;">//sample.ppa
//選択状態を調べる</span>
<span style="color:blue;">if S_IsTextSelected</span> = <span style="color:red;">0</span> <span style="color:blue;">then</span>
  <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'非選択状態です'</span>, <span style="color:#800000;">'title'</span>, <span style="color:red;">0</span>)

<span style="color:blue;">else if S_IsTextSelected</span> &gt; <span style="color:red;">1</span> <span style="color:blue;">then</span>
  <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'矩形選択状態です'</span>, <span style="color:#800000;">'title'</span>, <span style="color:red;">0</span>)

<span style="color:blue;">else if</span> (<span style="color:blue;">S_GetSelectColmFrom</span> = <span style="color:red;">1</span>) and (<span style="color:blue;">S_GetSelectColmTo</span> = <span style="color:red;">1</span>) <span style="color:blue;">then</span>
  <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'行選択状態です'</span>, <span style="color:#800000;">'title'</span>, <span style="color:red;">0</span>)

<span style="color:blue;">else if S_GetSelectLineFrom</span> = <span style="color:blue;">S_GetSelectLineTo</span> <span style="color:blue;">then</span>
  <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'１行以内の部分選択です'</span>, <span style="color:#800000;">'title'</span>, <span style="color:red;">0</span>)

<span style="color:blue;">else</span>
  <span style="color:blue;">MessageBox</span>(<span style="color:#800000;">'複数行にまたがった部分選択です'</span>, <span style="color:#800000;">'title'</span>, <span style="color:red;">0</span>)
;
</pre>

<hr>
</body></html>
